package ${package1}.${package2}.${package3}.service.impl;

import ${package1}.${package2}.${package3}.service.${table.name2}Service;
import ${package1}.${package2}.${package3}.pojo.${table.name2};
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
import ${package1}.${package2}.${package3}.dao.${table.name2}Mapper;
/**
 * @author arpgalaxy
 * @date 2021/3/12
 * @email 13605560342@163.com
 * @description
 */

@Service
public class ${table.name2}ServiceImpl implements ${table.name2}Service {

    @Resource
    ${table.name2}Mapper ${table.name2?uncap_first}Mapper;
    <#if table.key != "">
    @Override
    public ${table.name2} selectByPrimaryKey(<#list table.columns as column><#if column.columnKey=='PRI'><#if column?counter!=1>,</#if>${column.javaType} ${column.variableName}</#if></#list>) {
        return ${table.name2?uncap_first}Mapper.selectByPrimaryKey(<#list table.columns as column><#if column.columnKey=='PRI'><#if column?counter!=1>,</#if>${column.variableName}</#if></#list>);
    }
    </#if>
    @Override
    public List<${table.name2}> select${table.name2}s(Integer start,Integer limit) {
        List<${table.name2}> ${table.name2?uncap_first}s = ${table.name2?uncap_first}Mapper.select${table.name2}s(start,limit);
        return ${table.name2?uncap_first}s;
    }

    @Override
    public int select${table.name2}Total(){
        return ${table.name2?uncap_first}Mapper.select${table.name2}Total();
    }
    <#if table.key != "">
    @Override
    public int deleteByPrimaryKey(<#list table.columns as column><#if column.columnKey=='PRI'> <#if column?counter!=1>,</#if> ${column.javaType} ${column.variableName}</#if></#list>) {
        return ${table.name2?uncap_first}Mapper.deleteByPrimaryKey(<#list table.columns as column><#if column.columnKey=='PRI'><#if column?counter!=1>,</#if>${column.variableName}</#if></#list>);
    }
    </#if>
    @Override
    public int insert(${table.name2} obj) {
        return ${table.name2?uncap_first}Mapper.insert(obj);
    }
<#if table.key != "">
    @Override
    public int insertByDynamic(${table.name2} obj) {
        return ${table.name2?uncap_first}Mapper.insert(obj);
    }
</#if>
<#if table.key != "">
    @Override
    public int updateByPrimaryKey(${table.name2} obj) {
        return ${table.name2?uncap_first}Mapper.updateByPrimaryKey(obj);
    }
</#if>
<#if table.key != "">
    @Override
    public int updateByPrimaryKeyDynamic(${table.name2} obj) {
        return ${table.name2?uncap_first}Mapper.updateByPrimaryKey(obj);
    }
</#if>
}
